473,431 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,431 software developers and data experts.

Button images in DataGrid editing

Is there a way to use your own image in place of the automatic one that ASP
uses when doing editing in your DataGrid pages?

We already have a style of button we are using and would like to be
consistant.

Thanks,

Tom.
Nov 18 '05 #1
9 4582
tshad wrote:
Is there a way to use your own image in place of the automatic one that ASP
uses when doing editing in your DataGrid pages?

We already have a style of button we are using and would like to be
consistant.


Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the
EditText, CancelText, UpdateText properties of the EditCommandColumn to
the appropriate HTML (i.e., <img src=edit.gif>, or what have you).

If you are wanting, instead, to apply a CSS style (which you last
sentence makes it sound like), see this FAQ:
http://datawebcontrols.com/faqs/Butt...rButtons.shtml

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:
Is there a way to use your own image in place of the automatic one that
ASP uses when doing editing in your DataGrid pages?

We already have a style of button we are using and would like to be
consistant.
Tom, are you using an EditCommandColumn for the Edit/Update/Cancel buttons
in the DataGrid, and are wanting to replace those with a custom image
file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).


Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?

Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to set a
background or font property and the names are always different depending
whether you are using CSS or HTML or ASP.NET.

If you are wanting, instead, to apply a CSS style (which you last sentence
makes it sound like), see this FAQ:
http://datawebcontrols.com/faqs/Butt...rButtons.shtml
I am looking at this also. At the moment, I need a quick and dirty way to
do this.

Thanks,

Tom
Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #3
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:
Is there a way to use your own image in place of the automatic one that
ASP uses when doing editing in your DataGrid pages?

We already have a style of button we are using and would like to be
consistant.
Tom, are you using an EditCommandColumn for the Edit/Update/Cancel buttons
in the DataGrid, and are wanting to replace those with a custom image
file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).

Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to set > a background or font property and the names are always different depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET
SDK, or if you have Visual Studio .NET installed on your computer, you
have an offline documentation resource. There's also Google, MSDN, etc.
For example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp

Also, if you're going to be doing a lot of work with the DataGrid, might
I suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #4
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:

Is there a way to use your own image in place of the automatic one that
ASP uses when doing editing in your DataGrid pages?

We already have a style of button we are using and would like to be
consistant.

Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).

Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to

set > a background or font property and the names are always different
depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148
Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom
Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #5
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...

tshad wrote:

>Is there a way to use your own image in place of the automatic one that
>ASP uses when doing editing in your DataGrid pages?
>
>We already have a style of button we are using and would like to be
>consistant.

Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).
Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to

set > a background or font property and the names are always different
depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148


Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!


Nov 18 '05 #6
So it only works if the ButtonType is type LinkButton Not PushButton
Well all good!
"Patrick.O.Ige" wrote:
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
> news:41************@4guysfromrolla.com...
>
>>tshad wrote:
>>
>>>Is there a way to use your own image in place of the automatic one that
>>>ASP uses when doing editing in your DataGrid pages?
>>>
>>>We already have a style of button we are using and would like to be
>>>consistant.
>>
>>Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
>>buttons in the DataGrid, and are wanting to replace those with a custom
>>image file? If this is the case, all you have to do is set the EditText,
>>CancelText, UpdateText properties of the EditCommandColumn to the
>>appropriate HTML (i.e., <img src=edit.gif>, or what have you).
>
>
> Yes.
> <asp:EditCommandColumn EditText="Edit Info"
> visible="true"
> ButtonType="PushButton"
> UpdateText="Update" CancelText="Cancel" />
>
> Where would I put the imgs? I assume I would take out the EditText,
> UpdateText and CancelText. Where would I put it if it were Edit.png,
> Update.png and Cancel.png?

<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />

> Where is a good place to find properties for each object (DataGrid,
> EditCommandColumn etc)? I am always scrambling to find out how to
set > a background or font property and the names are always different
> depending whether you are using CSS or HTML or ASP.NET.

The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148


Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!


Nov 18 '05 #7
I find that it works, but it also puts a blue border around it for some
reason.

If I have it as an imagebutton it looks fine with no border around it:

<asp:ImageButton ID="ExpandButton" runat="server"
Font-Size="2" ImageUrl="../images/edit.png" Width="16" Height="16"
CommandName="Select" AlternateText="Click here to see
details"></asp:ImageButton>

If I have it as part of the EditCommandColumn I get this blue border. The
background colors are grey and orange that alternate.

<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'>"
CancelText="<img src='..\images\Cancel.png'>" />

The background colors are exactly the same for the ImageButton.

There is no border if I use the normal edittext button.

Why the border?

Thanks,

Tom.

"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
So it only works if the ButtonType is type LinkButton Not PushButton
Well all good!
"Patrick.O.Ige" wrote:
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
> news:41**************@4guysfromrolla.com...
> > tshad wrote:
> >> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in
> >> message
> >> news:41************@4guysfromrolla.com...
> >>
> >>>tshad wrote:
> >>>
> >>>>Is there a way to use your own image in place of the automatic one
> >>>>that
> >>>>ASP uses when doing editing in your DataGrid pages?
> >>>>
> >>>>We already have a style of button we are using and would like to be
> >>>>consistant.
> >>>
> >>>Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
> >>>buttons in the DataGrid, and are wanting to replace those with a
> >>>custom
> >>>image file? If this is the case, all you have to do is set the
> >>>EditText,
> >>>CancelText, UpdateText properties of the EditCommandColumn to the
> >>>appropriate HTML (i.e., <img src=edit.gif>, or what have you).
> >>
> >>
> >> Yes.
> >> <asp:EditCommandColumn EditText="Edit Info"
> >> visible="true"
> >> ButtonType="PushButton"
> >> UpdateText="Update" CancelText="Cancel" />
> >>
> >> Where would I put the imgs? I assume I would take out the EditText,
> >> UpdateText and CancelText. Where would I put it if it were
> >> Edit.png,
> >> Update.png and Cancel.png?
> >
> > <asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
> >
> > > Where is a good place to find properties for each object (DataGrid,
> > > EditCommandColumn etc)? I am always scrambling to find out how to
> > set > a background or font property and the names are always
> > different
> > > depending whether you are using CSS or HTML or ASP.NET.
> >
> > The technical documentation's a good start. If you download the .NET
> > SDK,
> > or if you have Visual Studio .NET installed on your computer, you
> > have an
> > offline documentation resource. There's also Google, MSDN, etc. For
> > example, to find the DataGrid properties just Google using:
> >
> > site:http://msdn.microsoft.com DataGrid class
> >
> > http://www.google.com/search?sourcei...DataGrid+class
> >
> > Whose first link is:
> > http://msdn.microsoft.com/library/de...ClassTopic.asp
>
> That helps a lot.
>
> >
> > Also, if you're going to be doing a lot of work with the DataGrid,
> > might I
> > suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
> > Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
> > Repeater:
> >
> > Sample Chapter:
> > http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
> > Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148
>
> Already have it and use it and really like it.
>
> I was just looking for someway to have at my fingertips a list of
> properties
> and methods of the controls that I can quickly access to get the
> correct
> spelling or format of a particular property. For example: do I use
> bkground
> or background or color or font-color.
>
> Thanks,
>
> Tom
> >
> > Happy Programming!
> >
> > --
> >
> > Scott Mitchell
> > mi******@4guysfromrolla.com
> > http://www.4GuysFromRolla.com
> >
> > * When you think ASP.NET, think 4GuysFromRolla.com!
>
>
>

Nov 18 '05 #8
Hi Tom,
You are right.But if you don't want the border do border='0' like
below.
Patrick
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png' border='0'>"
CancelText="<img src='..\images\Cancel.png' border='0'>" />

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Hi Tom,
You are right.But if you don't want the border do border='0' like
below.
Patrick
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png' border='0'>"
CancelText="<img src='..\images\Cancel.png' border='0'>" />

That did it.

Thanks,

Tom.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jphelan | last post by:
I am developping a software program that covers a range of nonprofit organization management needs through various modules. I am looking for images/symbols to use with buttons for navigating with....
2
by: Mike P | last post by:
I have a datagrid with a 'Delete' column that the user can click on to delete a row in the datagrid. I thought that I would need to have some kind of error handling in case somebody goes into the...
1
by: Pavel Gusak | last post by:
Hello. I've found DataGrid built-in edit functionality useless. My DataGrid has 9 columns, and is shown just nice until I press 'Edit' on a row. ASP.NET creates 9 TextBoxes, all the same very big...
8
by: sumit | last post by:
Hi, I want to add one java script function on the click of page button of datagrid. But how to get UI control of page button so that i should be able to add attribute for onClick event. ...
0
by: Stewart | last post by:
Sorry for the cross post. Not sure which forum covers these issues: I'm hoping someone can help me figure out what I'm missing in my code. I am trying to configure a Datagrid for editing. So...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
9
by: William Krick | last post by:
I'm currently using the following custom Stylish style sheet in Firefox 2.0.0.11... *{ color: black !important ; background: none !important; background- color: white !important } a:link {...
4
by: shalini166 | last post by:
I place command button in datagrid. When i click one button in the column.Another form or other datagrid will open. i don't how to make click event for column in the datagrid.please help me. ...
0
by: priyamtheone | last post by:
I have a datagridview with a button column as one of its column collection. The width of the button column is say 50 but the problem is the button editing control within the cell of that column is...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.